/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.base.manager.impl;

import java.util.Collection;
import java.util.List;

import com.xy.biz.base.domain.po.AttachmentPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xy.biz.base.domain.bo.AttachmentBO;
import com.xy.biz.base.domain.query.AttachmentQuery;
import com.xy.biz.base.domain.converter.AttachmentConverter;
import com.xy.biz.base.manager.AttachmentManager;
import com.xy.biz.base.dao.AttachmentDao;

/**
 *
 *
 * @author wwj
 * @date 2021-4-6
 */
@Service
public class AttachmentManagerImpl implements AttachmentManager {

	@Autowired
	private AttachmentDao attachmentDao;

	@Override
	public AttachmentBO saveAttachment(AttachmentBO attachmentBO) {
		AttachmentPO attachmentPO = AttachmentConverter.toPO(attachmentBO);
		int i = attachmentDao.saveAttachment(attachmentPO);
		return AttachmentConverter.fromPO(attachmentPO);
	}

	@Override
	public int saveAllAttachment(Collection<AttachmentBO> collection) {
		return attachmentDao.saveAllAttachment(AttachmentConverter.toPO(collection));
	}

	@Override
	public int updateAttachment(AttachmentBO attachmentBO) {
		return attachmentDao.updateAttachment(AttachmentConverter.toPO(attachmentBO));
	}

	@Override
	public int deleteAttachment(Long attachmentId) {
		return attachmentDao.deleteAttachment(attachmentId);
	}

	@Override
	public AttachmentBO getAttachment(Long attachmentId) {
		return AttachmentConverter.fromPO(attachmentDao.getAttachment(attachmentId));
	}

	@Override
	public List<AttachmentBO> listAttachmentById(Collection<Long> collection) {
		return AttachmentConverter.fromPO(attachmentDao.listAttachmentById(collection));
	}

	@Override
	public List<AttachmentBO> listAttachment(AttachmentQuery query) {
		return AttachmentConverter.fromPO(attachmentDao.listAttachment(query));
	}

	@Override
	public int countAttachment(AttachmentQuery query) {
		return attachmentDao.countAttachment(query);
	}

}
